package main

import (
	"fmt"
	"os"
	"path"
	"strings"
)

const rootPath1 = "/root/movie1/水月洞天"
const rootPath2 = "/root/movie1/灵镜传奇"

func ls(dirPath string) {
	newName1 := strings.Split(dirPath, "/")[len(strings.Split(dirPath, "/"))-1]
	readDir, err := os.ReadDir(dirPath)
	if err != nil {
		panic(err)
	}
	for _, subDirEntry := range readDir {
		if !subDirEntry.IsDir() {
			continue
		}
		subDirName := subDirEntry.Name()
		subDirPath := path.Join(dirPath, subDirName)
		readSubDir, err := os.ReadDir(subDirPath)
		if err != nil {
			panic(err)
		}
		for _, fileEntry := range readSubDir {
			if fileEntry.IsDir() {
				continue
			}
			if !strings.HasPrefix(fileEntry.Name(), fmt.Sprintf("《%s》", newName1)) {
				continue
			}
			fmt.Printf("%s\n", path.Join(subDirPath, fileEntry.Name()))
		}
	}
}

func main() {
	ls(rootPath1)
	ls(rootPath2)
}
